/*
 Erica Sadun, http://ericasadun.com
 iPhone Developer's Cookbook, 3.0 Edition
 BSD License, Use at your own risk
 Created by wxxu on 14-08-07.
 */

#import <UIKit/UIKit.h>

CGPoint CGRectGetCenter(CGRect rect);

CGRect  CGRectMoveToCenter(CGRect rect, CGPoint center);

@interface UIView (ViewFrameGeometry)

@property CGPoint origin;

@property CGSize size;

@property (readonly) CGPoint bottomLeft;

@property (readonly) CGPoint bottomRight;

@property (readonly) CGPoint topRight;

@property (readonly) CGPoint topLeft;

@property (nonatomic, assign) CGFloat height;

@property (nonatomic, assign) CGFloat width;

@property (nonatomic, assign) CGFloat top;

@property (nonatomic, assign) CGFloat left;

@property (nonatomic, assign) CGFloat bottom;

@property (nonatomic, assign) CGFloat right;

@property (nonatomic, assign) CGFloat x;

@property (nonatomic, assign) CGFloat y;

//bounds accessors
@property (nonatomic, assign) CGSize boundsSize;

@property (nonatomic, assign) CGFloat boundsWidth;

@property (nonatomic, assign) CGFloat boundsHeight;

//content getters
@property (nonatomic, readonly) CGRect contentBounds;

@property (nonatomic, readonly) CGPoint contentCenter;

//animation
- (void)crossfadeWithDuration:(NSTimeInterval)duration;

- (void)crossfadeWithDuration:(NSTimeInterval)duration completion:(void (^)(void))completion;

- (void) moveBy: (CGPoint) delta;

- (void) scaleBy: (CGFloat) scaleFactor;

- (void) fitInSize: (CGSize) aSize;

@end
